<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="white">
    <link rel="stylesheet" href="../dist/main.css">
</head>
<body>
<div id="login">
    <div class="center">
        <img src="" alt="logo" id="logo">
        <p id="loginTitle"></p>
    </div>
    <div class="box">
        <input type="text" placeholder="邮箱" id="email">
        <input type="password" placeholder="密码" id="pass">
        <div id="check">
            <i class="mui-icon mui-icon-checkmarkempty" style="display: none"></i>
        </div>
        <span style="font-size: 14px;color:#5d5d60;position: relative;bottom: 0.1rem;margin-left: 0.4rem">记住我</span>
        <a id="foget">忘记密码?</a>
        <button id="onLog" class="sureButton">登录</button>
        <a  class="noUsr" id="zc">还没有账号？快速注册</a>

    </div>
</div>
<script src="../dist/main.js"></script>
<script src="../dist/jquery.cookie.js"></script>

<script>
    var check;
    (function () {
        $("title").html(mt5Obj.title);
        $("#loginTitle").html(mt5Obj.loginTitle)
      if(sessionStorage.getItem("zcMail")){
          $("#email").val(sessionStorage.getItem("zcMail"));
      }


       if($.cookie('login')){
           $("#email").val($.cookie('login'));
           $("#pass").val($.cookie('password'));
           check=false;
           $("#check").children().show()
       }else{
           check=true;
       }

    })();
    console.log(check);

    $("#logo").attr("src",mt5Obj.logo);


    mui("body").on('tap','#onLog',function(){

        var mail=$("#email").val();
        var password=$("#pass").val();
        if(!check){
            $.cookie('login',mail,{ expires: 30 });
            $.cookie('password',password,{ expires: 30 });

        }
        if(mail=="" || pass==""){
                mui.alert("邮箱密码不能为空！");
        }else {
            $.ajax({
                url: mt5Obj.allUrl+"users/login",
                type:"post",
                data:{
                    mail:mail,
                    password:password,
                },
                success: function(data){
                    if(data.data){
                        goUrl("mowList","1")

                    }else if(data.error.code==11110033){
                        mui.alert("您的账号已被冻结！")
                    }else if(data.error.code==10010001){
                        mui.alert("用户名或密码错误！")
                    }
                    else{
                        mui.alert("登录失败！")
                    }
                }
            });
        }

    })
    mui("body").on('tap','#foget',function(){
        mui.openWindow({
            id:'fogetPass',
            url:'fogetPass.html'
        });

    })
    mui("body").on('tap','#zc',function(){
        mui.openWindow({
            id:'zc',
            url:'zc.html'
        });

    })

    mui("body").on('tap','#check',function(){
        if(check){
            $(this).children().show();
            check=false;
        }else {
            $(this).children().hide();
            check=true;
        }

    })
</script>

</body>
</html>


